<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
    <div id="box">
        <navbar :myname="myName">
            <!-- <navbar myname="wodetian"> -->
            <div>111111</div>
        </navbar>
    </div>

    <script>
        let obj = {
        //    data(){
        //     return{
        //         myName:'我的地'
        //     }
        //    },

        data:function(){
            return{
                myName:'我的地'
            }
        },

           mounted() {
            console.log("111")
           },
        //    上面create  mounted都没有变,下面的生命周期函数发生了改变  Vue3中的写法
        // 下面两种替代了销毁前,和销毁后
        beforeUnmount() {
            console.log("222")
        },
        unmounted() {
        
        },
        }
       let app = Vue.createApp(obj)
       
       app.component("navbar",{
        props:["myname"],
        template:`
        {{myname}}----
        <slot></slot>
        `
       })
       app.mount("#box")
    </script>
</body>
</html>